package util;

import entity.Patient;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @Author:
 * @Date: 2020-04-22
 * @Description: @PACKAGE:util
 * @version: 1.0
 */
public class PatientRowMapper implements RowMapper<Patient> {
    @Override
    public Patient getRow(ResultSet resultSet) {
        Patient patient = new Patient();
        //在结果集里拿数据，进行对象的赋值
        try {
            patient.setID(resultSet.getString(1));
            patient.setNum_Patient(resultSet.getInt(2));
            patient.setName(resultSet.getString(3));
            patient.setSex(resultSet.getString(4));
            patient.setAge(resultSet.getString(5));
            patient.setFamily_Name(resultSet.getString(6));
            patient.setTel_Number((resultSet.getString(7)).trim());
            patient.setImg_Path(resultSet.getString(8));
            patient.setPwd(resultSet.getString(9));


        } catch (SQLException e) {
            e.printStackTrace();
            System.out.println("未找到");
        }

        return patient;
    }
}
